/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.mes.action.quality;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.mes.mapper.quality.TestingDeviceMapper;
public class TestingDeviceAction extends BaseAction
{
    @Autowired(required=false)
	private TestingDeviceMapper mapper;
    /**
    操作规程
    */
    
    public Map checkDevNoteRules() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> file_admin=mapper.file_admin(params);
        result.put("file_admin", file_admin);
        
        return result;
    }
    /**
    保养规程
    */
    
    public Map checkDevNoteMaintain() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> file_admin=mapper.file_admin(params);
        result.put("file_admin", file_admin);
        
        return result;
    }
    /**
    饼状统计图
    */
    
    public Map devicePancake() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        SQLList<SQLMap> s_c=mapper.s_c(params);
        result.put("s_c", s_c);
        
        return result;
    }
    /**
    检测设备统计图
    */
    
    public Map cartogramTestingDevice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        super.listDepartments();
        
        
        SQLList<SQLMap> all=mapper.all(params);
        result.put("all", all);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        return result;
    }
    /**
    */
    
    public Object produce_info() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> produce_info=mapper.produce_info(params,pagination);
        produce_info.setPagedListInfo(pagination);
        result.put("produce_info", produce_info);
        
        return produce_info;
    }
    /**
    检测设备饼状统计图
    */
    
    public Map devicePancakePage() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        SQLList<SQLMap> s_c=mapper.s_c(params);
        result.put("s_c", s_c);
        
        return result;
    }
    /**
    检测设备信息信息
    */
    
    public Map deviceDetil() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> message=mapper.message(params);
        SQLMap message_emt=message.getExistfirst();
        result.put("message", message_emt);
        
        
        
        
        result.putAll(pubDetPage());
        
        return result;
    }
    /**
    明细公用页
    */
    
    public Map pubDetPage() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> phones=mapper.phones(params);
        result.put("phones", phones);
        
        
        SQLList<SQLMap> address=mapper.address(params);
        SQLMap address_emt=address.getExistfirst();
        result.put("address", address_emt);
        
        
        SQLList<SQLMap> email=mapper.email(params);
        result.put("email", email);
        
        
        SQLList<SQLMap> moment_info=mapper.moment_info(params);
        result.put("moment_info", moment_info);
        
        return result;
    }
    /**
    修改潜在客户
    */
    
    public Map potentialCustomerUp() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> message=mapper.message(params);
        SQLMap message_emt=message.getExistfirst();
        result.put("message", message_emt);
        
        
        SQLList<SQLMap> clienttype=mapper.clienttype(params);
        result.put("clienttype", clienttype);
        
        
        SQLList<SQLMap> clientmode=mapper.clientmode(params);
        result.put("clientmode", clientmode);
        
        
        SQLList<SQLMap> clientorigin=mapper.clientorigin(params);
        result.put("clientorigin", clientorigin);
        
        
        SQLList<SQLMap> clientrate=mapper.clientrate(params);
        result.put("clientrate", clientrate);
        
        
        SQLList<SQLMap> clientbus=mapper.clientbus(params);
        result.put("clientbus", clientbus);
        
        return result;
    }
    /**
    增加电话号码
    */
    
    public Map pubDetPagePhoneAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> phone=mapper.phone(params);
        result.put("phone", phone);
        
        
        SQLList<SQLMap> phonetype=mapper.phonetype(params);
        result.put("phonetype", phonetype);
        
        return result;
    }
    /**
    增加电子邮件
    */
    
    public Map pubDetPageEailAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> mails=mapper.mails(params);
        result.put("mails", mails);
        
        
        SQLList<SQLMap> emailtype=mapper.emailtype(params);
        result.put("emailtype", emailtype);
        
        return result;
    }
    /**
    增加即时通讯地址
    */
    
    public Map pubDetPageImmAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> momentcon=mapper.momentcon(params);
        result.put("momentcon", momentcon);
        
        
        SQLList<SQLMap> momentconano=mapper.momentconano(params);
        result.put("momentconano", momentconano);
        
        
        SQLList<SQLMap> ims=mapper.ims(params);
        result.put("ims", ims);
        
        return result;
    }
    /**
    增加地址
    */
    
    public Map pubDetPageAdressAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> textmsgs=mapper.textmsgs(params);
        result.put("textmsgs", textmsgs);
        
        
        
        return result;
    }
    /**
    修改公用页
    */
    
    public Map pubDetPageUp() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> phone=mapper.phone(params);
        result.put("phone", phone);
        
        
        SQLList<SQLMap> address=mapper.address(params);
        SQLMap address_emt=address.getExistfirst();
        result.put("address", address_emt);
        
        
        SQLList<SQLMap> email_info=mapper.email_info(params);
        result.put("email_info", email_info);
        
        
        SQLList<SQLMap> phonetype=mapper.phonetype(params);
        result.put("phonetype", phonetype);
        
        
        SQLList<SQLMap> emailtype=mapper.emailtype(params);
        result.put("emailtype", emailtype);
        
        
        SQLList<SQLMap> contact_ifno=mapper.contact_ifno(params);
        result.put("contact_ifno", contact_ifno);
        
        
        
        
        SQLList<SQLMap> momentcon=mapper.momentcon(params);
        result.put("momentcon", momentcon);
        
        
        SQLList<SQLMap> momentconano=mapper.momentconano(params);
        result.put("momentconano", momentconano);
        
        
        
        
        SQLList<SQLMap> s_province=mapper.s_province(params);
        result.put("s_province", s_province);
        
        
        SQLList<SQLMap> s_city=mapper.s_city(params);
        result.put("s_city", s_city);
        
        
        SQLList<SQLMap> s_district=mapper.s_district(params);
        result.put("s_district", s_district);
        
        
        
        return result;
    }
    /**
    新增加检验设备
    */
    
    public Map checkDevNoteNAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        SQLList<SQLMap> s_sname=mapper.s_sname(params);
        result.put("s_sname", s_sname);
        
        
        result.put("produce_device", create_code(getParameter("CMID5"),"produce_barcode"));
        
        
        SQLList<SQLMap> s_mname=mapper.s_mname(params);
        result.put("s_mname", s_mname);
        
        
        SQLList<SQLMap> s_product_info=mapper.s_product_info(params);
        result.put("s_product_info", s_product_info);
        
        return result;
    }
    /**
    检测设备搜索
    */
    
    public Map checkDevNoteSearch() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> abrasives=mapper.abrasives(params);
        result.put("abrasives", abrasives);
        
        
        SQLList<SQLMap> fixture=mapper.fixture(params);
        result.put("fixture", fixture);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        
        
        
        SQLList<SQLMap> s_province=mapper.s_province(params);
        result.put("s_province", s_province);
        
        
        params.def("address_province",-1);
        SQLList<SQLMap> s_city=mapper.s_city(params);
        result.put("s_city", s_city);
        
        
        params.def("address_city",-1);
        SQLList<SQLMap> s_district=mapper.s_district(params);
        result.put("s_district", s_district);
        
        return result;
    }
    /**
    搜索结果
    */
    
    public Map searchList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> produce_info=mapper.produce_info(params,pagination);
        produce_info.setPagedListInfo(pagination);
        result.put("produce_info", produce_info);
        
        return result;
    }
    /**
    */
    
    public Map d_file() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_file(params);
        
        return result;
    }
    /**
    增加新文件修改
    */
    
    public Map checkDevNoteRulesFilesSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int i_file = mapper.i_file(params);
        result.put("i_file", i_file);
        
        return result;
    }
    /**
    增加文件修改
    */
    
    public Map checkDevNoteMaintainFilesSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int i_filenote = mapper.i_filenote(params);
        result.put("i_filenote", i_filenote);
        
        return result;
    }
    /**
    */
    
    public Map d_device() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_device(params);
        
        return result;
    }
    /**
    修改潜在客户修改
    */
    
    public Map potentialCustomerUpSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.potentialCustomerUpSubmit(params);
        
        return result;
    }
    /**
    增加电话号码修改
    */
    
    public Map pubDetPagePhoneAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("phones")){
            params=new SQLParam(request,emt.getMap());
            mapper.ph_id(params);
        }
        
        return result;
    }
    /**
    增加电子邮件修改
    */
    
    public Map pubDetPageEailAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("email")){
            params=new SQLParam(request,emt.getMap());
            mapper.em_id(params);
        }
        
        return result;
    }
    /**
    增加即时通讯地址修改
    */
    
    public Map pubDetPageImmAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("moment_contact")){
            params=new SQLParam(request,emt.getMap());
            mapper.pubDetPageImmAddSubmit(params);
        }
        
        return result;
    }
    /**
    增加地址修改
    */
    
    public Map pubDetPageAdressAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("address")){
            params=new SQLParam(request,emt.getMap());
            mapper.address(params);
        }
        
        return result;
    }
    /**
    修改公用页修改
    */
    
    public Map pubDetPageUpSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("phones")){
            params=new SQLParam(request,emt.getMap());
            params.def("phone_area",null);
            mapper.b_phones(params);
        }
        
        
        mapper.pubDetPageUpSubmit(params);
        
        
        for (SQLMap emt:hqlBean.getTableElements("email")){
            params=new SQLParam(request,emt.getMap());
            mapper.b_email(params);
        }
        
        
        for (SQLMap emt:hqlBean.getTableElements("moment_contact")){
            params=new SQLParam(request,emt.getMap());
            mapper.b_moment_contact(params);
        }
        
        return result;
    }
    /**
    */
    
    public Map i_product() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMID = mapper.CMID(params);
        result.put("CMID", CMID);
        
        return result;
    }
    public Map ajaxList(){
        String sql="";
        String pagesql="";
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        if(request.getParameter("cfield_name").contains("product_info")){
            SQLList<SQLMap> product_info=mapper.product_info(params);
            result.put("product_info", product_info);
        }
        
        return result;
    }
}